<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

</head>
<body>
    <div id="app">
        <input placeholder="请输入搜索词" v-model="enter">
        <ul>
            <li v-for="v in search()">
                {{v}}
            </li>
        </ul>
    </div>

    <script>
        let app = new Vue({
            el:'#app',
            data:{
                enter:'',
                text:[
                    "碧玉妆成一树高",
                    "万条垂下绿丝绦",
                    "不知细叶谁裁出",
                    "二月春风似剪刀",
                ]
            },
            methods:{
                search:function(){
                    if(this.enter.length == 0){
                        console.log("1");
                        return this.text;
                    }
                    return this.text.filter(o => o.indexOf(this.enter) != -1);
                }
            }
        })
    </script>
</body>
</html>